<template tag="以下文档内容为hycli自动生成">
  <div style="height: 100%">
    <div style="margin:0.8rem;"><h5 style="display:inline">我的便签</h5><span style="margin-left: 0.5rem; color:#999"> 我的日常任务便签</span>
    </div>
    <hr style="margin-top:0;color:#999"/>
<div class="listbar">
  <el-row>
    <!-- note NOTE -CMPNT-->
   <el-col :span='24'>
     <aabat ref="ext_aabat" @query="query_note_aabat" :data="note_dataList" @save="save_note_aabat" @update="update_note_aabat" @del="del_note_aabat"  @changeSort="changeSort_note_aabat"></aabat>
   </el-col>
</el-row>
</div>
<div>
</div>
  </div>
</template>
<script>
// 我的便签
import aabat from "@/views/cmpnts/note.vue"



export default {
components: {
    aabat,
},
data() {
  return {
    shortcuts: this.$js.page.latestDays(),
    cmpnt_funcs:{},
    conf: {
      loading: false,
      progressColor: this.$theia.env.conf.progress || []
    },
    ganttIdx: -1,
        form_aaban: {
            pi: 1,
            ps: 15,
            disabled:false,
            single_date_range_name:"",
            single_date_range_value:[],
            single_text_name:"",
            single_text_value:"",
            },
            dataList_aaban:[],
            multiQueryDateRange:[],
            multiQueryText:[],
            total_aaban:0,
            note_dataList:[],
};
  },
mounted() {
  this.loadEnums_aaban()
  this.form_aaban.single_date_range_name = (this.multiQueryDateRange[0]||{}).value
  this.form_aaban.single_text_name = (this.multiQueryText[0]||{}).value
  this.cmpnt_funcs["aabat"] = this.show_cmpnt_aabat

  this.form_aaban = Object.assign(this.form_aaban,this.$route.params)
  this.queryData_aaban ()
    },
methods: {
  ganttChange(id) {
      this.ganttIdx = id
    },
    query_note_aabat(form) {
        let that = this
        this.$theia.http.post("/ws/my/note/qnote",form).then(res=>{
        that.note_dataList = res.items
        }).catch(res=>{
            // let code = ((res||{}).response||{}).status||0
            // let msg = `查询数据失败(${code})`
            // that.$notify.error({title: '失败',message: msg,duration:5000})
        });
    },
    save_note_aabat(form) {
        let that = this
        this.$theia.http.post("/ws/my/note/save",form).then(res=>{
            that.query_note_aabat()
        }).catch(res=>{
            // let code = ((res||{}).response||{}).status||0
            // let msg = `创建失败(${code})`
            // that.$notify.error({title: '失败',message: msg,duration:5000})
        });
    },
    update_note_aabat(form) {
        let that = this
        this.$theia.http.post("/ws/my/note/update",form).then(res=>{
            that.query_note_aabat()
        }).catch(res=>{
            // let code = ((res||{}).response||{}).status||0
            // let msg = `更新内容失败(${code})`
            // that.$notify.error({title: '失败',message: msg,duration:5000})
        });
    },
    del_note_aabat(form) {
        let that = this
        this.$theia.http.post("/ws/my/note/del",form).then(res=>{
            that.query_note_aabat()
        }).catch(res=>{
            // let code = ((res||{}).response||{}).status||0
            // let msg = `删除失败(${code})`
            // that.$notify.error({title: '失败',message: msg,duration:5000})
        });
    },
    changeSort_note_aabat(form) {
        let that = this
        this.$theia.http.post("/ws/my/note/sort",form).then(res=>{
            that.query_note_aabat()
        }).catch(res=>{
            // let code = ((res||{}).response||{}).status||0
            // let msg = `更新排序失败(${code})`
            // that.$notify.error({title: '失败',message: msg,duration:5000})
        });
    },

queryData_aaban(mform = {},nform={}){
    //构建查询参数
    let queryForm = Object.assign({},this.form_aaban)
    queryForm = Object.assign(queryForm,nform||{})
    
    //处理多个日期选择
    queryForm[this.form_aaban.single_date_range_name] = this.form_aaban.single_date_range_value
    queryForm[this.form_aaban.single_text_name] = this.form_aaban.single_text_value
   
    //处理日期范围选择

    queryForm[this.form_aaban.single_date_range_name] = null
    queryForm.single_date_range_value = null
    queryForm.single_date_range_name = null

    queryForm.single_text_value = null
    queryForm.single_text_name = null
 
    //处理关联表my_note my_note 
   
    //发送查询请求
    let that = this
    that.conf.loading = true
    //构建统计查询
    this.$refs.ext_aabat.show(this.form_aaban)
  },

  resetItemData_aaban(that,lst){
    lst.forEach(item => {
      item.__raw = Object.assign({}, item)
    if(item.children){
      that.resetItemData_aaban(that,item.children)
    }
  });
  },
    loadEnums_aaban(){
    },

  handleSizeChange(ps){
    this.form_aaban.ps = ps
    this.onQuery(true)
  },
  handleCurrentChange(pi){
    this.form_aaban.pi = pi
    this.onQuery()
  },
  onQuery(refresh){
    if(refresh){
      this.form_aaban.pi = 1
    }
    this.queryData_aaban ()
  },
},
};
</script>
<style>
.el-dialog{
  border-radius:5px !important
}
</style>
<style scoped>
.el-form-item {
  margin-right: 10px !important;
}

.opts .el-button--small {
  margin-left: 0px;
  padding-left: 0px;
  margin-right: 4px;
}

/deep/.el-table td.el-table__cell div {
  vertical-align: middle;
}
/deep/.el-button+.el-dropdown{
  margin-left:0px;
}
/deep/.el-button+.el-button{
  margin-left:0px;
}
.el-button{
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.blist {
  margin-bottom: 8px;
  width: 100%;
}

.blist .el-radio-group {
  margin-right: 8px;
}

.ddl {
  margin-bottom: 8px;
  width: 100%;

}

.ddl .el-dropdown {
  margin-right: 8px;
}

.listbar {
  margin-bottom: 8px;
  text-align: center;
}
 .el-dropdown-link {
  cursor: pointer;
  color: var(--el-color-primary);
  display: flex;
  align-items: center;
  font-size: 0.65rem;
}
/deep/.el-button--small{
  padding: 5px 4px;
}

.prepend /deep/.el-input__wrapper{
  border-top-right-radius:0;
  border-bottom-right-radius:0;
}
.prepend+/deep/.el-date-editor{
  border-top-left-radius:0;
  border-bottom-left-radius:0;
  border-left:0;
}

</style>